package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IUnusualDailyFeedBackForInstallView;
import com.cloudsigns.factorymanager2.engineering.IView.IUnusualFeedBackForLogisticsDelayView;
import com.cloudsigns.factorymanager2.engineering.model.IUnusualFeedBackForInstallModel;
import com.cloudsigns.factorymanager2.engineering.model.IUnusualFeedBackForLogisticsDelayModel;
import com.cloudsigns.factorymanager2.engineering.model.UnusualFeedBackForInstallModel;
import com.cloudsigns.factorymanager2.engineering.model.UnusualFeedBackForLogisticsDelayModel;

/**
 * Created by tony on 2018/4/20.
 */

public class UnusualFeedBackForLogisticsDelayPrsenter {
    private IUnusualFeedBackForLogisticsDelayView view;
    private IUnusualFeedBackForLogisticsDelayModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public UnusualFeedBackForLogisticsDelayPrsenter(IUnusualFeedBackForLogisticsDelayView view) {
        this.view = view;
        this.model = new UnusualFeedBackForLogisticsDelayModel();
    }

    public void submitUnusualFeedBackForLogisticsDelay() {


        model.submitUnusualFeedBackForLogisticsDelay(view.getDelayDays(), view.getId(),view.getItemId(),view.getType(),view.getUnusualDays(),new UnusualFeedBackForLogisticsDelayModel.OnUnusualFeedBackFrorLogisticsDelayListener() {
                    @Override
                    public void submitUnusualFeedBackForrLogisticsDelaySunccessed() {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.submitUnusualFeedBackForLogisticsDelaySuccessed();
                                view.hideLoading();
                            }
                        });
                    }

                    @Override
                    public void submitUnusualFeedBackForrLogisticsDelayFailed(final String desc) {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.submitUnusualFeedBackForLogisticsDelayFailed(desc);
                                view.hideLoading();
                            }
                        });
                    }
                });

    }
}
